from django.shortcuts import render
from django.http import HttpResponse, request
from django.template import loader


# Create your views here.

def index(request):
    template = loader.get_template('index.html')
    context = {
        'city': '北京',
        'adict': {
            'name': '西游记',
            'author': '吴承恩'
        },
        'alist': [1,2,3,4,5]
    }
    # return HttpResponse(template.render(context)) # 1
    return render(request, 'index.html', context)   # 2

def say(request):
    url = reversed('users:index')
    print(url)
    return HttpResponse('say')

def demo_view(request):
    print('view 视图被调用')
    return HttpResponse('OK')